# Maintainer: Peter Budai <peterbudai@hotmail.com>

_realname=prometheus-client
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.7.1
pkgrel=1
pkgdesc="Prometheus instrumentation library for Python applications (mingw-w64)"
arch=('any')
url="https://github.com/prometheus/client_python"
license=('APACHE')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/prometheus/client_python/archive/v${pkgver}.tar.gz")
sha256sums=('6bfe4192c03f81c36c86a2dd7cd1fa151e470cd3d9fd24fe15e63abb85383aa0')

prepare() {
  rm -rf python-build-${CARCH} | true
  cp -r "client_python-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
